<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>爱学标品</title>
    <style>
        .content{
            line-height: 30px;
            font-size: 14px;
            color: #333;
            display: flex;
            justify-content: center;
            flex-direction: column;
            align-items: center;
            position: absolute;
            top: 30%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
        .st_num{
            color: #3399cc;
        }
        .btn{
            background: #3399cc;
            color: #fff;
            font-size: 18px;
            height: 40px;
            line-height: 40px;
            width: 108px;
            border-radius: 10px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="content">
        <div class="img">
            <img src="<%=request.getContextPath()%>/static/images/xkw.png"/>
        </div>
        <div>温馨提示：成功添加<label class="st_num">${size}</label>组大题</div>
        <div>请关闭当前页面回到原文档查看</div>
        <c:if test="${type == 'paper' || type == 'entranceTest'}">
            <button class="btn" onclick="window.location.href = `${callBackUrl}`">关闭</button>
        </c:if>
        <c:if test="${type == 'knowledge' || type == 'handout'}">
            <button class="btn" onclick="op()">关闭</button>
        </c:if>
    </div>
</body>
<script>
    var arr = window.location.href.split('@');
    var targetOrigin = "http://" + arr[arr.length - 1].split('?')[0];
    function op() {
        window.opener.postMessage({
            type: 'xkw_save',
            name: 'xkw_save'
        }, targetOrigin);
        window.close();
    }
</script>
</html>